﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.Services;
using IntelligentAgriculture.WebAPI.Application.Command.UnitCommand;
using IntelligentAgriculture.WebAPI.Application.Command.UserCommand;
using IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepCommandHandler;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.UnitCommandHandler
{

    public class UnitProvinceCommandHandler : IRequestHandler<UnitProviceCommand, Results<List<Province>>>
    {

        private readonly IUnitService unitService;
        private readonly ILogger<UnitProvinceCommandHandler> logger;
        public UnitProvinceCommandHandler(IUnitService unitService, ILogger<UnitProvinceCommandHandler> logger)
        {
            this.unitService = unitService;
            this.logger = logger;
        }



        /// <summary>
        /// 省列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<List<Province>>> Handle(UnitProviceCommand request, CancellationToken cancellationToken)
        {
            var userInfo = await unitService.ProvinceList();
            return Results<List<Province>>.DataResult(userInfo);
        }








    }



}
